#pragma once
#include <winsock2.h>
#include <list>
#include <mutex>
#pragma comment(lib, "ws2_32")

class Service {
public:
    explicit Service(const char* addr = "127.0.0.1", int port = 9999, int connMax = 100);
    ~Service();
    void allSend(const char* msg);
    void monitor();
private:
    WSAData wsaData{};
    SOCKET  servSock;
    SOCKADDR_IN servAddr{};
    std::list<SOCKET> socketList{};
    std::mutex m;
    void connAccept();
};
